package com.food.service.impl;

import com.food.mapper.FoodMapper;
import com.food.model.Food;
import com.food.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Collections;

@Service
public class FoodServiceImpl implements FoodService {

    @Autowired
    private FoodMapper foodMapper;

    @Override
    public List<Food> searchFoods(String keyword) {
        return foodMapper.searchByKeyword(keyword);
    }

    @Override
    public Food getFoodById(Integer foodId) {
        return foodMapper.findById(foodId);
    }

    @Override
    public List<Food> getFoodsByCategory(String category) {
        return foodMapper.findByCategory(category);
    }

    @Override
    public List<String> getAllCategories() {
        return foodMapper.findAllCategories();
    }
} 